import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
import router from "./router";
import store from "./store";

// Element Plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// 全局样式
import "./styles/index.scss";

// 屏蔽 ResizeObserver 警告
window.addEventListener("error", e => {
  if (
    e.message.includes("ResizeObserver loop completed with undelivered notifications") ||
    e.message.includes("ResizeObserver loop limit exceeded")
  ) {
    e.stopImmediatePropagation();
  }
});

const app = createApp(App);

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(store).use(router).use(ElementPlus).mount("#app");
